﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Drawing;
using System.Data;
using System.Linq;
using System.Text;
using System.Windows.Forms;

namespace SnmpForm.APConfig.Wan
{
    public partial class ucWan : ucAPConfig
    {
        public ucWan()
        {
            InitializeComponent();
        }

        public override void LoadAp()
        {
            comboBoxWanConnectType.DataSource =
                AP_DEFINE_DATA.WAN_CONNECT_TYPE.Clone();
            Update();
        }

        public override bool Update(bool bView = true)
        {
            if (bView)
            {
            }
            else
            {
            }
            return true;
        }

        private void comboBoxWanConnectType_SelectedIndexChanged(object sender, EventArgs e)
        {
            panelWanConnect.Controls.Clear();
            ApConfigItem item = null;
            item = (ApConfigItem)comboBoxWanConnectType.SelectedValue;
            int type = (int)item.Value;
            ucAPConfig uc = null;
            switch (type)
            {
                case 0:
                    uc = new ucDynamicIp();
                    break;
                case 1:
                    uc = new ucStaticIp();
                    break;
                case 2:
                    uc = new ucPPPoE();
                    break;
                default:
                    break;
            }
            if (uc != null)
            {
                panelWanConnect.Controls.Add(uc);
            }
        }
    }
}
